package ar.com.globallogic.promomr.api.converters;

import ar.com.globallogic.promomr.api.resources.PublicationFilterRequest;
import ar.com.globallogic.promomr.domain.AgeContentFilter;
import ar.com.globallogic.promomr.domain.ContentFilter;
import ar.com.globallogic.promomr.domain.DefaultContentFilter;
import ar.com.globallogic.promomr.domain.GenderContentFilter;
import ar.com.globallogic.promomr.domain.OverAgeContentFilter;
import ar.com.globallogic.promomr.domain.UnderAgeContentFilter;

public class PublicationFilterConverter {
	
	public static ContentFilter convert(PublicationFilterRequest request){
		if(request.getType().equals("GENDER")){
			return new GenderContentFilter(request.getGender());
		}
		if(request.getType().equals("AGE")){
			return new AgeContentFilter(request.getMinAge(), request.getMaxAge());
		}
		if(request.getType().equals("UNDER_AGE")){
			return new UnderAgeContentFilter(request.getMinAge());
		}
		if(request.getType().equals("OVER_AGE")){
			return new OverAgeContentFilter(request.getMaxAge());
		}
		return new DefaultContentFilter();
	}

}
